// 检查数据库表结构的脚本
const db = require('./db/db');

async function checkTableStructure() {
  try {
    console.log('检查business_cards表结构...');
    
    const tableStructure = await db.query('DESCRIBE business_cards');
    console.log(JSON.stringify(tableStructure, null, 2));
    
    // 特别检查zip字段的定义
    const zipField = tableStructure.find(field => field.Field === 'zip');
    if (zipField) {
      console.log('\nzip字段定义:');
      console.log(`类型: ${zipField.Type}`);
      console.log(`是否允许NULL: ${zipField.Null}`);
      console.log(`默认值: ${zipField.Default}`);
    } else {
      console.log('\n未找到zip字段');
    }
    
    process.exit(0);
  } catch (error) {
    console.error('检查数据库表结构时发生错误:', error);
    process.exit(1);
  }
}

// 执行检查
checkTableStructure(); 